/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Quick Studio Components.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

import QtQuick
import QtQuick.Window
import AS_TOOL_UI

Window {
    width: 1080
    height: 600
    minimumWidth: 840
    minimumHeight: 400
    visible: true
    title: "阿衰多功能助手V3.0"

    Screen01 {
        id: mainScreen
        width: parent.width
        height: parent.height

        recDataPage.onWidthChanged: {
            if(recDataPage.width <= 524) recDataPage.width = 524
            else if(recDataPage.width >= 600) recDataPage.width = 600
        }

        function recDataDisplay(recByte) {
            // 停止显示是否选中
            if (rxEN_btn.highlighted) {
                // ASCII/HEX显示 和 日志显示 在后者函数的两个参数里
                recDataEdit.insert(recDataEdit.length, myClass.get_recData(myClass.get_pageIndex(), rxCode_btn.text, displayDate_btn.highlighted))
            }
            rxByteText.text = recByte
        }
        function sendDataDisplay(sendByte) {
            txByteText.text = sendByte
            if (txEN_btn.highlighted) {
                recDataEdit.insert(recDataEdit.length, myClass.get_sendData(rxCode_btn.text, displayDate_btn.highlighted))
            }
        }

        slider_color.onMoved: {
            serial_ip_page.color = Qt.rgba((slider_color.value % 5 / 5.0).toFixed(1), (slider_color.value % 25 / 5 / 5.0).toFixed(1), (slider_color.value / 25 / 5.0).toFixed(1), 1)
            if(slider_color.value === 0.0 || slider_color.value === 125.0)
            {
                serial_ip_page.color = "#20000000"
            }
            //console.log(slider_color.value, (slider_color.value % 5 / 5.0).toFixed(1), (slider_color.value % 25 / 5 / 5.0).toFixed(1), (slider_color.value / 25 / 5.0).toFixed(1))
        }

        data_originEdit.onTextChanged: {
            myClass.on_originData_textChanged(data_originEdit.getText(0, data_originEdit.length))
            data_englishByteTextinput.text = myClass.get_enBytes()
            data_chineseByteTextinput.text = myClass.get_zh_cnBytes()
        }
        data_changeBtn.onClicked: {
            data_originEdit.textFormat = TextEdit.PlainText
            data_originEdit.text = myClass.on_changeBtn_clicked(data_originEdit.getText(0, data_originEdit.length), data_codeCombo.currentIndex)
        }
        data_fine2Btn.onClicked: {
            data_originEdit.textFormat = TextEdit.AutoText
            data_originEdit.text = myClass.on_findBtn2_clicked(data_originEdit.getText(0, data_originEdit.length), data_target1Edit.getText(0, data_target1Edit.length))
        }
        data_fine1Btn.onClicked: {
            data_originEdit.textFormat = TextEdit.AutoText
            data_originEdit.text = myClass.on_findBtn1_clicked(data_originEdit.getText(0, data_originEdit.length), data_target1Edit.getText(0, data_target1Edit.length))
        }
        data_deleta2Btn.onClicked: {
            data_originEdit.textFormat = TextEdit.AutoText
            data_originEdit.text = myClass.on_deleteBtn2_clicked(data_originEdit.getText(0, data_originEdit.length), data_target1Edit.getText(0, data_target1Edit.length), data_target2Edit.getText(0, data_target2Edit.length))
        }
        data_deleta1Btn.onClicked: {
            //console.log(data_originEdit.getText(0, data_originEdit.length))
            data_originEdit.textFormat = TextEdit.AutoText
            data_originEdit.text = myClass.on_deleteBtn1_clicked(data_originEdit.getText(0, data_originEdit.length), data_target1Edit.getText(0, data_target1Edit.length), data_target2Edit.getText(0, data_target2Edit.length))
        }
        data_target2TitleMouse.onClicked: {
            myClass.on_targetTitle2_clicked()
        }
        data_target1TitleMouse.onClicked: {
            myClass.on_targetTitle1_clicked()
        }
        data_originTitleMouse.onClicked: {
            myClass.on_originTitle_clicked()
        }
        data_target2Mouse.onWheel: function(wheel){
            if (wheel.angleDelta.y > 0) {
                data_vbar3.decrease()
            }
            else {
                data_vbar3.increase()
            }
        }
        data_target1Mouse.onWheel: function(wheel){
            if (wheel.angleDelta.y > 0) {
                data_vbar2.decrease()
            }
            else {
                data_vbar2.increase()
            }
        }
        data_originMouse.onWheel: function(wheel){
            if (wheel.angleDelta.y > 0) {
                data_vbar1.decrease()
            }
            else {
                data_vbar1.increase()
            }
        }
        data_target2Mouse.onClicked: {
            data_target2Edit.forceActiveFocus()
        }
        data_target1Mouse.onClicked: {
            data_target1Edit.forceActiveFocus()
        }
        data_originMouse.onClicked: {
            data_originEdit.forceActiveFocus()
        }
/****************************serial ip*********************************/

        ip_switch.onClicked: {
            if(ip_switch.checked)
            {
                ip_nameCombo.enabled = false
                ip_myAddrText.enabled = false
                ip_myPortText.enabled = false
                ip_otherAddrText.enabled = false
                ip_otherPortText.enabled = false
            }
            else
            {
                ip_nameCombo.enabled = true
                ip_myAddrText.enabled = true
                ip_myPortText.enabled = true
                ip_otherAddrText.enabled = true
                ip_otherPortText.enabled = true
            }
            myClass.on_ipSwitch_clicked(ip_switch.checked, ip_myAddrText.text, ip_myPortText.text, ip_otherAddrText.text, ip_otherPortText.text);
        }
        ip_nameCombo.onCurrentIndexChanged: {
            myClass.set_pageIndex(ip_nameCombo.currentIndex+2)
            txByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2)
            rxByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2-1)
            switch(ip_nameCombo.currentIndex)
            {
                case 0:
                    ip_myAddrText.enabled = false
                    ip_myPortText.enabled = false
                    ip_otherAddrText.enabled = true
                    ip_otherPortText.enabled = true
                    break;
                case 1:
                    ip_myAddrText.enabled = true
                    ip_myPortText.enabled = true
                    ip_otherAddrText.enabled = false
                    ip_otherPortText.enabled = false
                    break;
                case 2:
                    ip_myAddrText.enabled = true
                    ip_myPortText.enabled = true
                    ip_otherAddrText.enabled = true
                    ip_otherPortText.enabled = true
                    break;
            }
        }

        txClearBtn.onClicked: {
            myClass.clear_RxTxByte(myClass.get_pageIndex()*2)
            txByteText.text = 0
        }
        rxClearBtn.onClicked: {
            myClass.clear_RxTxByte(myClass.get_pageIndex()*2-1)
            rxByteText.text = 0
        }
        serial_nameCombo.onPressedChanged: {
            serial_nameCombo.model = myClass.get_serialName()
        }
        serial_nameCombo.onCurrentTextChanged: {
            if(serial_nameCombo.currentIndex >= 0)
            {
                serial_descriptionLab.text =  myClass.get_serialDescription(serial_nameCombo.currentIndex)
            }
        }
        txAutoSend_btn.onClicked: {
            if(serial_switch.checked || ip_switch.checked)
            {
                txAutoSend_btn.highlighted = !txAutoSend_btn.highlighted
                myClass.on_autoSend_clicked(txAutoSend_btn.highlighted, autoSendTime.text)
            }
            else
            {
                serial_switch.highlighted = true
                ip_switch.highlighted = true
            }
        }
        serial_switch.onCheckedChanged: {
            serial_switch.highlighted = false
            if(serial_switch.checked)
            {
                serial_nameCombo.enabled = false
                serial_boudCombo.enabled = false
                serial_checkBitCombo.enabled = false
                serial_dataBitCombo.enabled = false
                serial_stopBitCombo.enabled = false
            }
            else
            {
                serial_nameCombo.enabled = true
                serial_boudCombo.enabled = true
                serial_checkBitCombo.enabled = true
                serial_dataBitCombo.enabled = true
                serial_stopBitCombo.enabled = true
            }
            myClass.on_serial_switch_clicked(serial_switch.checked, serial_nameCombo.currentText, serial_boudCombo.currentText)
        }
        txSend_btn.onClicked: {
            if(serial_switch.checked || ip_switch.checked)
            {
                myClass.set_sendDate(myClass.get_pageIndex(), sendDataEdit.getText(0, sendDataEdit.length), txSuffixCombo.currentIndex, txCode_btn.text)
            }
            else
            {
                serial_switch.highlighted = true
                ip_switch.highlighted = true
            }
        }
        txClear_btn.onClicked: {
            sendDataEdit.clear()
        }
        txCode_btn.onClicked: {
            txCode_btn.text = txCode_btn.text !== "ASCII" ? "ASCII" : "HEX"
        }
        rxClear_btn.onClicked: {
            recDataEdit.clear()
        }
        saveFile_btn.onClicked: {
            myClass.on_save_file_clicked(recDataEdit.getText(0, recDataEdit.length))
        }
        displayDate_btn.onClicked: {
            displayDate_btn.highlighted = !displayDate_btn.highlighted
        }
        // 文本变化就滑动滑动条到底
        recDataEdit.onTextChanged: {
            vbar1.increase()
        }
        recDataMouse.onClicked: {
            // MouseArea点击后将焦点给到TextEdit
            recDataEdit.forceActiveFocus()
        }
        recDataMouse.onWheel: function(wheel){
            // 鼠标滚轮位置
            if (wheel.angleDelta.y > 0) {
                // ScrollBar移动
                vbar1.decrease()
            }
            else {
                vbar1.increase()
            }
        }
        sendDataMouse.onClicked: {
            sendDataEdit.forceActiveFocus()
        }
        sendDataMouse.onWheel: function(wheel){
            console.log(wheel.angleDelta.y)
            if (wheel.angleDelta.y > 0) {
                vbar2.decrease()
            }
            else {
                vbar2.increase()
            }
        }
        rxCode_btn.onClicked: {
            rxCode_btn.text = rxCode_btn.text !== "ASCII" ? "ASCII" : "HEX"
        }
        txEN_btn.onClicked: {
            txEN_btn.highlighted = !txEN_btn.highlighted
        }
        rxEN_btn.onClicked: {
            rxEN_btn.highlighted = !rxEN_btn.highlighted
        }

        tabBar.onCurrentIndexChanged: {
            switch(tabBar.currentIndex)
            {
                case 0:
                    // visible显示/隐藏
                    myMouseArea.visible = true
                    serial_leftSidePage.visible = true
                    ip_leftSidePage.visible = false
                    data_page.visible = false
                    test_page.visible = false
                    myClass.set_pageIndex(tabBar.currentIndex+1)
                    txByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2)
                    rxByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2-1)
                    break
                case 1:
                    myMouseArea.visible = true
                    serial_leftSidePage.visible = false
                    ip_leftSidePage.visible = true
                    data_page.visible = false
                    test_page.visible = false
                    myClass.set_pageIndex(ip_nameCombo.currentIndex+2)
                    txByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2)
                    rxByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2-1)
                    switch(ip_nameCombo.currentIndex)
                    {
                        case 0:
                            ip_myAddrText.enabled = false
                            ip_myPortText.enabled = false
                            ip_otherAddrText.enabled = true
                            ip_otherPortText.enabled = true
                            break;
                        case 1:
                            ip_myAddrText.enabled = true
                            ip_myPortText.enabled = true
                            ip_otherAddrText.enabled = false
                            ip_otherPortText.enabled = false
                            break;
                        case 2:
                            ip_myAddrText.enabled = true
                            ip_myPortText.enabled = true
                            ip_otherAddrText.enabled = true
                            ip_otherPortText.enabled = true
                            break;
                    }
                    break
                case 2:
                    myMouseArea.visible = false
                    data_page.visible = true
                    test_page.visible = false
                    break
                case 3:
                    myMouseArea.visible = false
                    data_page.visible = false
                    test_page.visible = true
                    break
            }
        }
/*********************************************快捷内容框内容本地存储**************************************************/
        shortcut_CtrlText1.onTextChanged: {
            myClass.shortcut_data_save(1, shortcut_CtrlText1.text)
        }
        shortcut_CtrlText2.onTextChanged: {
            myClass.shortcut_data_save(2, shortcut_CtrlText2.text)
        }
        shortcut_CtrlText3.onTextChanged: {
            myClass.shortcut_data_save(3, shortcut_CtrlText3.text)
        }
        shortcut_CtrlText4.onTextChanged: {
            myClass.shortcut_data_save(4, shortcut_CtrlText4.text)
        }
        shortcut_CtrlText5.onTextChanged: {
            myClass.shortcut_data_save(5, shortcut_CtrlText5.text)
        }
        shortcut_AltText1.onTextChanged: {
            myClass.shortcut_data_save(6, shortcut_AltText1.text)
        }
        shortcut_AltText2.onTextChanged: {
            myClass.shortcut_data_save(7, shortcut_AltText2.text)
        }
        shortcut_AltText3.onTextChanged: {
            myClass.shortcut_data_save(8, shortcut_AltText3.text)
        }
        shortcut_AltText4.onTextChanged: {
            myClass.shortcut_data_save(9, shortcut_AltText4.text)
        }
        shortcut_AltText5.onTextChanged: {
            myClass.shortcut_data_save(10, shortcut_AltText5.text)
        }
        shortcut_Texta.onTextChanged: {
            myClass.shortcut_data_save(11, shortcut_Texta.text)
        }
        shortcut_Textb.onTextChanged: {
            myClass.shortcut_data_save(12, shortcut_Textb.text)
        }
        shortcut_Textc.onTextChanged: {
            myClass.shortcut_data_save(13, shortcut_Textc.text)
        }
        shortcut_Textd.onTextChanged: {
            myClass.shortcut_data_save(14, shortcut_Textd.text)
        }
        shortcut_Texte.onTextChanged: {
            myClass.shortcut_data_save(15, shortcut_Texte.text)
        }
        shortcut_Textf.onTextChanged: {
            myClass.shortcut_data_save(16, shortcut_Textf.text)
        }
        shortcut_Textg.onTextChanged: {
            myClass.shortcut_data_save(17, shortcut_Textg.text)
        }
        shortcut_Texth.onTextChanged: {
            myClass.shortcut_data_save(18, shortcut_Texth.text)
        }
        shortcut_Texti.onTextChanged: {
            myClass.shortcut_data_save(19, shortcut_Texti.text)
        }
/*********************************************快捷内容发送按键**************************************************/
        shortcut_Btn1.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_CtrlText1.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn2.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_CtrlText2.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn3.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_CtrlText3.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn4.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_CtrlText4.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn5.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_CtrlText5.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn6.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_AltText1.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn7.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_AltText2.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn8.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_AltText3.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn9.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_AltText4.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn10.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_AltText5.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn11.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Texta.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn12.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Textb.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn13.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Textc.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn14.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Textd.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn15.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Texte.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn16.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Textf.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn17.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Textg.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn18.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Texth.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
        shortcut_Btn19.onClicked: {
            myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Texti.text, txSuffixCombo.currentIndex, txCode_btn.text)
        }
/*********************************************快捷方式/快捷键**************************************************/
        Shortcut {
            sequence: "Ctrl+Q"
            onActivated: mainScreen.txCode_btn.clicked()
        }
        Shortcut {
            sequence: "Ctrl+W"
            onActivated: mainScreen.sendDataEdit.clear()
        }
        Shortcut {
            sequence: "Ctrl+E"
            onActivated: mainScreen.txSend_btn.clicked()
        }
        Shortcut {
            sequence: "Ctrl+R"
            onActivated: mainScreen.txAutoSend_btn.clicked()
        }
        Shortcut {
            sequence: "Alt+1"
            onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_AltText1.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
        }
        Shortcut {
            sequence: "Alt+2"
            onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_AltText2.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
        }
        Shortcut {
            sequence: "Alt+3"
            onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_AltText3.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
        }
        Shortcut {
            sequence: "Alt+4"
            onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_AltText4.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
        }
        Shortcut {
            sequence: "Alt+5"
            onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_AltText5.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
        }
        Shortcut {
            sequence: "Ctrl+1"
            onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_CtrlText1.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
        }
        Shortcut {
            sequence: "Ctrl+2"
            onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_CtrlText2.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
        }
        Shortcut {
            sequence: "Ctrl+3"
            onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_CtrlText3.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
        }
        Shortcut {
            sequence: "Ctrl+4"
            onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_CtrlText4.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
        }
        Shortcut {
            sequence: "Ctrl+5"
            onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_CtrlText5.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
        }
        Shortcut {
            sequence: "Ctrl+="
            onActivated: mainScreen.recDataEdit.font.pixelSize++
        }
        Shortcut {
            sequence: "Ctrl+-"
            onActivated: mainScreen.recDataEdit.font.pixelSize--
        }

/*********************************************详情显示 hover**************************************************/
        shortcut_titleTextMouse.onEntered: {
            hoverDescriptionText.text = "切换编码：Ctrl+Q\n清除内容：Ctrl+W\n单次发送：Ctrl+E\n自动发送：Ctrl+R\n输入内容：Ctrl+序号\n输入内容：Alt+序号"
            hoverDescriptionPage.x = myMouseArea.mouseX - hoverDescriptionText.width
            hoverDescriptionPage.y = myMouseArea.mouseY
            hoverDescriptionPage.visible = true
        }
        shortcut_titleTextMouse.onExited: {
            hoverDescriptionPage.visible = false
        }
        rxClearBtn.onHoveredChanged: {
            if(rxClearBtn.hovered)
            {
                hoverDescriptionText.text = "清零接收字节计数"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        txClearBtn.onHoveredChanged: {
            if(txClearBtn.hovered)
            {
                hoverDescriptionText.text = "清零发送字节计数"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        rxCode_btn.onHoveredChanged: {
            if(rxCode_btn.hovered)
            {
                hoverDescriptionText.text = "接收编码方式"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        rxEN_btn.onHoveredChanged: {
            if(rxEN_btn.hovered)
            {
                hoverDescriptionText.text = "接收显示开关, 绿色为接收数据"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        txEN_btn.onHoveredChanged: {
            if(txEN_btn.hovered)
            {
                hoverDescriptionText.text = "发送回显开关, 白色为回显数据"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        displayDate_btn.onHoveredChanged: {
            if(displayDate_btn.hovered)
            {
                hoverDescriptionText.text = "时间戳显示开关"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        saveFile_btn.onHoveredChanged: {
            if(saveFile_btn.hovered)
            {
                hoverDescriptionText.text = "接收区保存至文件"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        rxClear_btn.onHoveredChanged: {
            if(rxClear_btn.hovered)
            {
                hoverDescriptionText.text = "接收区清空"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        slider_color.onHoveredChanged: {
            if(slider_color.hovered)
            {
                hoverDescriptionText.text = "背景色滑动条"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        txCode_btn.onHoveredChanged: {
            if(txCode_btn.hovered)
            {
                hoverDescriptionText.text = "发送编码方式"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        txClear_btn.onHoveredChanged: {
            if(txClear_btn.hovered)
            {
                hoverDescriptionText.text = "发送区清空"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        txSend_btn.onHoveredChanged: {
            if(txSend_btn.hovered)
            {
                hoverDescriptionText.text = "发送数据"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        txAutoSend_btn.onHoveredChanged: {
            if(txAutoSend_btn.hovered)
            {
                hoverDescriptionText.text = "自动发送开关"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        autoSendTime.onHoveredChanged: {
            if(autoSendTime.hovered)
            {
                hoverDescriptionText.text = "自动发送时间/ms"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        txSuffixCombo.onHoveredChanged: {
            if(txSuffixCombo.hovered)
            {
                hoverDescriptionText.text = "发送数据后缀"
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        ip_myAddrText.onHoveredChanged: {
            if(ip_myAddrText.hovered)
            {
                switch(ip_nameCombo.currentIndex)
                {
                    case 0: hoverDescriptionText.text = "不使用, 不可编辑"; break;
                    case 1: hoverDescriptionText.text = "可不填, 默认本地IP地址"; break;
                    case 2: hoverDescriptionText.text = "可不填, 默认本地IP地址"; break;
                }
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        ip_myPortText.onHoveredChanged: {
            if(ip_myPortText.hovered)
            {
                switch(ip_nameCombo.currentIndex)
                {
                    case 0: hoverDescriptionText.text = "不使用, 不可编辑"; break;
                    case 1: hoverDescriptionText.text = "监听端口号即本地端口号"; break;
                    case 2: hoverDescriptionText.text = "监听端口号即本地端口号"; break;
                }
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        ip_otherAddrText.onHoveredChanged: {
            if(ip_otherAddrText.hovered)
            {
                switch(ip_nameCombo.currentIndex)
                {
                    case 0: hoverDescriptionText.text = "服务器IP地址"; break;
                    case 1: hoverDescriptionText.text = "不使用, 不可编辑"; break;
                    case 2: hoverDescriptionText.text = "远程IP地址"; break;
                }
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }
        ip_otherPortText.onHoveredChanged: {
            if(ip_otherPortText.hovered)
            {
                switch(ip_nameCombo.currentIndex)
                {
                    case 0: hoverDescriptionText.text = "服务器端口号"; break;
                    case 1: hoverDescriptionText.text = "不使用, 不可编辑"; break;
                    case 2: hoverDescriptionText.text = "远程端口号"; break;
                }
                hoverDescriptionPage.x = myMouseArea.mouseX
                hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
                hoverDescriptionPage.visible = true
            }
            else
            {
                hoverDescriptionPage.visible = false
            }
        }

        // 左侧边栏鼠标悬停
        //        frame.onHoveredChanged: {
//            if(frame.hovered)
//            {
//                console.log("1111");
//            }
//            else
//            {
//                console.log("2222");
//            }
//        }

    }


}


/*##^##
Designer {
    D{i:0;formeditorZoom:0.66}
}
##^##*/
